import { Vue } from 'vue-property-decorator';
import Invest from '@/common/dict/invest';
import moment from 'moment';
import { PrefixInteger, numberFormat, unitShow, dateFormat, objToVxeFilterArr, getConfigItem, accMul, numberFormatXDAY } from '@/utils/tools';
import DictionConstUtil from '@/utils/diction-const-util';

export default class ColumnUtil extends Vue {
    Invest: any = new Invest();
    SHOW_SECURITY = getConfigItem('SHOW_SECURITY');
    WEB_DOCKING = getConfigItem('WEB_DOCKING');
    // 转表格筛选下拉框数据
    objToArr(param) {
        const list = [];
        for (const key in param) {
            list.push({ label: param[key], value: key });
        }
        return list;
    }
    // 券商模式下的额外字段展示
    otherAssetColumns = [
        { content: '资产单元编号', id: 'assetCode', width: 140, minWidth: 140, type: 'func', funcBody: value => value || '--' },
        { content: '资产单元名称', id: 'assetName', width: 140, minWidth: 140, type: 'func', funcBody: value => value || '--' },
    ];
    // 试算结果全部表格列(默认为右对齐)
    riskTableColumn: any[] = [
        { content: '产品代码', id: 'fundCode', sortable: false, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        { content: '产品名称', id: 'fundNameSt', sortable: false, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        { content: '证券代码', id: 'stockCode', sortable: true, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        { content: '证券名称', id: 'stockNameSt', sortable: false, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        { content: '条目编号', id: 'entryCode', sortable: true, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        { content: '风险说明', id: 'entryName', sortable: false, align: 'left', filterType: 'search', filters: [{ data: '' }] },
        {
            content: '风险类型',
            id: 'entryType',
            sortable: false,
            align: 'center',
            filterType: 'funnel',
            filters: this.objToArr(this.Invest.entryType),
            filterMethod: ({ value, row }) => row.entryType == value,
        },
        { content: '风控阈值', id: 'thresholdValue', sortable: false, align: 'right' },
        { content: '比较方向', id: 'compareType', sortable: false, align: 'center' },
        { content: '委托方向', id: 'orderDirection', sortable: false, align: 'left' },
        { content: '计算结果(单位)', id: 'calculateValue', sortable: false, align: 'right' },
        {
            content: '阈值类型',
            id: 'thresholdType',
            sortable: true,
            align: 'center',
            filterType: 'funnel',
            filters: this.objToArr(this.Invest.ThresholdType),
            filterMethod: ({ value, row }) => row.thresholdType == value,
        },
        { content: '可投余量', id: 'investableBalance', sortable: false, align: 'center' },
        { content: '最大可交易量', id: 'maxTradable', sortable: false, align: 'center' },
        { content: '最大可交易量(汇总)', id: 'maxTradableMerge', sortable: false, align: 'center' },
        { content: '静态条目KEY', id: 'entryKey', sortable: false, align: 'left' },
    ];

    get riskTableColumns() {
        return this.handleResultColumns(this.riskTableColumn, 'id');
    }

    // 风险试算列表表格列
    instTableColumns: any[] = [
        { val: 'fundCode', name: '产品代码/名称', minWidth: 150, type: 'func', funcBody: (value, row) => value + '/' + row.fundNameSt },
        { val: 'fundAccountCode', name: '组合编码/名称', minWidth: 150, type: 'func', funcBody: (value, row) => value + '/' + row.fundAccountName },
        { val: 'stockCode', name: '证券(合约)代码/名称', minWidth: 150, type: 'func', funcBody: (value, row) => value + '/' + row.stockNameSt },
        { val: 'instType', name: '指令类型', minWidth: 100 },
        { val: 'exchangeType', name: '交易所指令类型', minWidth: 130 },
        { val: 'orderDirection', name: '委托方向', minWidth: 80 },
        { val: 'instructionTypeName', name: '业务类型', minWidth: 80 },
        {
            val: 'investType',
            name: '投资类型',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value ? this.Invest.investType[value] || '--' : '--'),
        },
        {
            val: 'orderPrice',
            name: '指令(净价|全价)价格',
            minWidth: 150,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            val: 'orderAmount',
            name: '指令(融出|全价)数量',
            minWidth: 150,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            val: 'orderBalance',
            name: '指令(合约|回购|存款|全价)金额',
            minWidth: 220,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        { val: 'destCombiId', name: '转入组合编码', minWidth: 120 },
        { val: 'destCombiName', name: '转入组合名称', minWidth: 150 },
        { val: 'destSecurityCode', name: '转入证券代码', minWidth: 150 },
        { val: 'destSecurityName', name: '转入证券名称', minWidth: 150 },
        { val: 'bulkType', name: '巨额赎回', minWidth: 100, type: 'func', funcBody: value => (value ? this.Invest.bulkType[value] || '--' : '--') },
        {
            val: 'clearSpeed',
            name: '清算速度',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value ? this.Invest.clearSpeed[value] || '--' : '--'),
        },
        { val: 'fullPrice', name: '全价价格', minWidth: 80, type: 'func', funcBody: value => (value != undefined ? numberFormat(value, 2) : '--') },
        {
            val: 'stockFaceBalance',
            name: '券面总额',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 4) : '--'),
        },
        { val: 'firstSettleDate', name: '结算日期', minWidth: 80, type: 'func', funcBody: value => dateFormat(value) || '--' },
        { val: 'startDate', name: '起息日', minWidth: 80, type: 'func', funcBody: value => dateFormat(value) || '--' },
        { val: 'endSettleDate', name: '到期日期', minWidth: 80, type: 'func', funcBody: value => dateFormat(value) || '--' },
        {
            val: 'orderRate',
            name: '回购利率(%)',
            minWidth: 100,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        { val: 'curName', name: '币种', minWidth: 80 },
        { val: 'marketCode', name: '交易市场', minWidth: 80 },
        { val: 'orderPriceType', name: '价格模式', minWidth: 80 },
        {
            val: 'depositType',
            name: '存款类型',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value ? this.Invest.depositType[value] || '--' : '--'),
        },
        {
            val: 'depositRate',
            name: '存款利率(%)',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            val: 'advanceLimitFlag',
            name: '支取类型',
            minWidth: 80,
            type: 'func',
            funcBody: value => (value ? this.Invest.advanceLimitFlagType[value] || '--' : '--'),
        },
        { val: 'noticeDays', name: '通知天数', minWidth: 80 },
        { val: 'deadline', name: '期限', minWidth: 80 },
        { val: 'rate', name: '费率', minWidth: 80, type: 'func', funcBody: value => (value != undefined ? numberFormat(value, 2) : '--') },
        { val: 'opponentCode', name: '交易对手', minWidth: 80 },
        {
            val: 'winningRate',
            name: '预估中签率',
            minWidth: 100,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '操作',
            type: 'btn',
            width: 120,
            fixed: 'right',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-edit',
                    title: '编辑',
                },
                {
                    type: 'danger',
                    icon: 'el-icon-delete',
                },
            ],
        },
    ];

    // 产品持仓表格列
    fundPositionColum = [
        { name: '产品代码', val: 'fundCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAccountCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '证券代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        { name: '证券名称', val: 'stockName', minWidth: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '日初持仓数量',
            val: 'marketAmount',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '日初持仓市值(元)',
            val: 'marketValue',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '当日买入数量',
            val: 'todayBuyAmount',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '当日买入成交数量',
            val: 'todayBuyDeal',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '当日卖出数量',
            val: 'todaySellAmount',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '当日卖出成交数量',
            val: 'todaySellDeal',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '当前可用数量',
            val: 'currUsableAmount',
            width: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        { name: '多空类型', val: 'bullberType', width: 110, type: 'func', funcBody: value => (value ? this.Invest.bullbearType[value] : '--') },
        {
            name: '证券内评',
            val: 'stockOuterGradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '证券外评',
            val: 'stockInnergradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人内评',
            val: 'issueOuterGradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人外评',
            val: 'issueInnergradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
    ];

    get fundPositionColums() {
        return this.handleTableColumns(this.fundPositionColum, 'val');
    }
    // 交易所指令、银行间债券指令、交易所大宗交易指令、上交所固定收益指令、场外开放式基金指令产品持仓字段
    proPositionColumn = [
        { name: '证券代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '证券名称',
            val: 'stockNameSt',
            minWidth: 110,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '证券类别', val: 'stockTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
            align: 'right',
        },
        { name: '产品编码', val: 'fundCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '持仓标志', val: 'bullBearName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '投资类型', val: 'investTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '发行人编码', val: 'issueCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人名称', val: 'issueName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        {
            name: '证券内评(恒生)',
            val: 'stockInnerGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '证券外评(恒生)',
            val: 'stockOuterGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人内评(恒生)',
            val: 'issueInnerGradeInfo',
            minWidth: 140,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人外评(恒生)',
            val: 'issueOuterGradeInfo',
            minWidth: 140,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
    ];

    get proPositionColumns() {
        return this.handleTableColumns(this.proPositionColumn, 'val');
    }
    // 在途转融通(仅应用于转融通单独tab标签页)
    refinancingPositionColumns = [
        { name: '合同编号', val: 'contractNo', minWidth: 150, type: 'func', funcBody: value => value || '--' },
        { name: '产品编码', val: 'fundCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '证券代码', val: 'stockCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        {
            name: '证券名称',
            val: 'stockName',
            minWidth: 110,
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '融出数量',
            val: 'marketAmount',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value === 0 || value ? numberFormat(value) : '--'),
        },
        {
            name: '已展期数量',
            val: 'extendsAmount',
            width: 110,
            type: 'func',
            funcBody: value => (value === 0 || value ? numberFormat(value) : '--'),
        },
        {
            name: '已了结数量',
            val: 'returnAmount',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value === 0 || value ? numberFormat(value) : '--'),
        },
        { name: '期限', val: 'redeemDays2', width: 140, type: 'func', funcBody: value => (value === 0 || value ? numberFormat(value) : '--') },
        { name: '展期天数', val: 'extendsDays', width: 110, type: 'func', funcBody: value => (value === 0 || value ? numberFormat(value) : '--') },
        {
            name: '费率(%)',
            val: 'dealPrice',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value === 0 || value ? numberFormat(value, '%') : '--'),
        },
        // { name: '预计罚息', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        // { name: '合约类型', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        // { name: '展期标识', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        // { name: '提前了结标识', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '合约到期日', val: 'redeemLawdate', minWidth: 110, type: 'func', funcBody: value => dateFormat(value) || '--' },
        { name: '实际到期日', val: 'redeemLiquidate', minWidth: 110, type: 'func', funcBody: value => dateFormat(value) || '--' },
        {
            name: '限售出借标志',
            val: 'strategyPlacingName',
            minWidth: 110,
            type: 'func',
            funcBody: value => value || '--',
            // funcBody: value => this.Invest.strategyPlacing[value] || '--',
        },
    ];
    // 银行间回购持仓字段
    repoPositionColum = [
        { name: '证券代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '证券名称',
            val: 'stockNameSt',
            minWidth: 110,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '证券类别', val: 'stockType', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        {
            name: '到期购回金额(元)',
            val: 'ghBalance',
            width: 130,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value, 2) || '--'),
            align: 'right',
        },
        { name: '购回交割日期', val: 'settleDate', minWidth: 110, type: 'funcTime', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { name: '产品编码', val: 'fundCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', width: 180, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
    ];

    get repoPositionColums() {
        return this.handleTableColumns(this.repoPositionColum, 'val');
    }

    selectPositionsColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-close',
                },
            ],
        },
        { val: 'fundCode', name: '产品编码', minWidth: 100 },
        { val: 'fundName', name: '产品名称', minWidth: 180 },
        { val: 'fundAcCode', name: '组合编码', minWidth: 100 },
        { val: 'fundAcName', name: '组合名称', minWidth: 100 },
        { val: 'receiptNo', name: '存单号', minWidth: 100 },
        { val: 'confirmNo', name: '确认编号', minWidth: 100 },
        { val: 'depositConfirmNo', name: '存单确认号', minWidth: 100 },
        { val: 'status', name: '存单状态', minWidth: 100, type: 'func', funcBody: value => (value == '1' ? '存款存入' : '--'), align: 'center' },
        { val: 'depositDate', name: '存入日期', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'accountNo', name: '存款帐号', minWidth: 100 },
        { val: 'bankNo', name: '银行总行编码', minWidth: 120 },
        { val: 'bankName', name: '银行总行名称', minWidth: 120 },
        { val: 'minorBankName', name: '存款支行', minWidth: 100 },
        // { val: 'place', name: '存款地', minWidth: 80 },
        { val: 'beginDate', name: '起息日', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'endDate', name: '到期日', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'depositTerm', name: '存款期限(天)', minWidth: 120, align: 'right' },
        { val: 'depositRemainingTerm', name: '存款剩余期限(天)', minWidth: 150, align: 'right' },
        { val: 'balance', name: '存单金额(元)', minWidth: 120, align: 'right' },
        { val: 'receivableInterest', name: '应收利息(元)', minWidth: 120, align: 'right' },

        { val: 'totalBalance', name: '本息合计(元)', minWidth: 120, align: 'right' },
        { val: 'rate', name: '存款利率(%)', minWidth: 120, align: 'right' },
        { val: 'advanceRate', name: '提前支取利率(%)', minWidth: 150, align: 'right' },
        { val: 'punishInterest', name: '罚息金额(元)', minWidth: 120, align: 'right' },
        { val: 'notifyDays', name: '通知天数', minWidth: 100, align: 'right' },
        {
            val: 'advanceLimitFlag',
            name: '提前支取限制',
            minWidth: 120,
            type: 'func',
            funcBody: value => this.Invest.advanceLimitFlag[value] || '--',
            align: 'center',
        },
        { val: 'remark', name: '备注', minWidth: 120 },
    ];

    // 存款持仓字段
    CKPositionsColumn = [
        // {
        //     name: '操作',
        //     type: 'btn',
        //     width: 60,
        //     fixed: 'left',
        //     btns: [
        //         {
        //             type: 'primary',
        //             icon: 'el-icon-check',
        //             isDisabled: value => value['disabled'],
        //         },
        //     ],
        // },
        { val: 'fundCode', name: '产品编码', minWidth: 100 },
        { val: 'fundName', name: '产品名称', minWidth: 180 },
        { val: 'fundAcCode', name: '组合编码', minWidth: 100 },
        { val: 'fundAcName', name: '组合名称', minWidth: 100 },
        { val: 'receiptNo', name: '存单号', minWidth: 100 },
        { val: 'confirmNo', name: '确认编号', minWidth: 100 },
        { val: 'depositConfirmNo', name: '存单确认号', minWidth: 100 },
        { val: 'status', name: '存单状态', minWidth: 100, type: 'func', funcBody: value => (value == '1' ? '存款存入' : '--'), align: 'center' },
        { val: 'depositDate', name: '存入日期', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'accountNo', name: '存款帐号', minWidth: 100 },
        { val: 'bankNo', name: '银行总行编码', minWidth: 120 },
        { val: 'bankName', name: '银行总行名称', minWidth: 120 },
        { val: 'minorBankName', name: '存款支行', minWidth: 100 },
        // { val: 'place', name: '存款地', minWidth: 80 },
        { val: 'beginDate', name: '起息日', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'endDate', name: '到期日', minWidth: 120, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { val: 'depositTerm', name: '存款期限(天)', minWidth: 120, align: 'right' },
        { val: 'depositRemainingTerm', name: '存款剩余期限(天)', minWidth: 150, align: 'right' },
        { val: 'balance', name: '存单金额(元)', minWidth: 120, align: 'right' },
        { val: 'receivableInterest', name: '应收利息(元)', minWidth: 120, align: 'right' },
        { val: 'totalBalance', name: '本息合计(元)', minWidth: 120, align: 'right' },
        { val: 'rate', name: '存款利率(%)', minWidth: 120, align: 'right' },
        { val: 'advanceRate', name: '提前支取利率(%)', minWidth: 150, align: 'right' },
        { val: 'punishInterest', name: '罚息金额(元)', minWidth: 120, align: 'right' },
        { val: 'notifyDays', name: '通知天数', minWidth: 100, align: 'right' },
        {
            val: 'advanceLimitFlag',
            name: '提前支取限制',
            minWidth: 120,
            type: 'func',
            funcBody: value => this.Invest.advanceLimitFlag[value] || '--',
            align: 'center',
        },
        { val: 'remark', name: '备注', minWidth: 120 },
    ];

    get CKPositionsColumns() {
        return this.handleTableColumns(this.CKPositionsColumn, 'val');
    }

    // 期货指令产品持仓字段
    FuturesPositionColumn = [
        { name: '合约代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '合约名称',
            val: 'stockNameSt',
            minWidth: 110,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '证券类别', val: 'stockTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
            align: 'right',
        },
        { name: '产品编码', val: 'fundCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '持仓标志', val: 'bullBearName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '投资类型', val: 'investTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
    ];

    get FuturesPositionColumns() {
        return this.handleTableColumns(this.FuturesPositionColumn, 'val');
    }

    // 可申购证券信息
    UnderNetStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },

        { name: '证券代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '证券名称',
            val: 'stockName',
            minWidth: 110,
            search: true,
            filters: [{ data: '' }],
        },
        { name: '证券类别', val: 'stockTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '发行人序号', val: 'issuerCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人名称', val: 'issuerName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        {
            name: '价格下限(元)',
            val: 'lowerPrice',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '价格上限(元)',
            val: 'upperPrice',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        { name: '缴款截止日期', val: 'payLimitDate', minWidth: 110, type: 'funcTime', funcBody: value => dateFormat(value) || '--', align: 'center' },
        {
            name: '网下申购数量下限',
            val: 'lowerApplyAmount',
            minWidth: 150,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '网下申购数量上限',
            val: 'upperApplyAmount',
            minWidth: 150,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '定金比例(%)',
            val: 'earnestRatio',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
            align: 'right',
        },
        {
            name: '定金金额',
            val: 'earnestBalance',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        { name: '中签日期', val: 'lotDate', minWidth: 110, type: 'funcTime', funcBody: value => dateFormat(value) || '--', align: 'center' },
        {
            name: '发行总量',
            val: 'issueAmount',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        { name: '申购类别', val: 'applyTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        { name: '利率类型', val: 'basicInterestTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--', align: 'center' },
        {
            name: '是否有担保',
            val: 'assureType',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value ? (value === '0' ? '无担保' : '有担保') : '--'),
            align: 'center',
        },
        {
            name: '是否附送权证',
            val: 'attachWarrant',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value ? (value === '0' ? '否' : '是') : '--'),
            align: 'center',
        },
    ];

    // 证券持仓表格列
    stockPositionColums = [
        { name: '产品代码', val: 'fundCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAccountCode', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '产品名称', val: 'fundName', width: 110, type: 'func', funcBody: value => value || '--' },
        { name: '证券代码', val: 'stockCode', width: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        { name: '证券名称', val: 'stockName', minWidth: 110, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '日初持仓数量',
            val: 'marketAmount',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '日初持仓市值(元)',
            val: 'marketValue',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '当日买入数量',
            val: 'todayBuyAmount',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '当日买入成交',
            val: 'todayBuyDeal',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '当日卖出数量',
            val: 'todaySellAmount',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '当日卖出成交',
            val: 'todaySellDeal',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '当前可用数量',
            val: 'currUsableAmount',
            width: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        // { name: '当前数量', val: 'currentAmount', width: 110 },
        // { name: '证券市值', val: 'totalValue', width: 110 },
        { name: '多空类型', val: 'bullberType', width: 110, type: 'func', funcBody: value => (value ? this.Invest.bullbearType[value] : '--') },
        {
            name: '证券内评',
            val: 'stockOuterGradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '证券外评',
            val: 'stockInnergradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人内评',
            val: 'issueOuterGradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人外评',
            val: 'issueInnergradeInfo',
            width: 110,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
    ];

    // 指令信息公共表格列
    instInfoCommonColumns = [
        { content: '指令序号', id: 'instNo', minWidth: 120 },
        { content: '产品代码', id: 'fundCode', minWidth: 120 },
        { content: '产品名称', id: 'fundNameSt', minWidth: 120 },
        { content: '组合编码', id: 'fundAccountCode', minWidth: 150 },
        { content: '组合名称', id: 'fundAccountName', minWidth: 150 },
        { content: '证券代码', id: 'stockCode', minWidth: 120 },
        { content: '证券名称', id: 'stockNameSt', minWidth: 120 },
        { content: '业务类型', id: 'instructionTypeName', minWidth: 120 },
        { content: '委托方向', id: 'orderDirection', minWidth: 120 },
        { content: '投资类型', id: 'investType', minWidth: 120 },
        { content: '价格模式', id: 'orderPriceType', minWidth: 120 },
        { content: '指令价格(元)', id: 'orderPrice', minWidth: 140 },
        { content: '指令数量(张)', id: 'orderAmount', minWidth: 140 },
        { content: '指令金额(元)', id: 'orderBalance', minWidth: 140 },
        { content: '币种', id: 'curCode', minWidth: 100 },
        { content: '交易市场', id: 'marketCode', minWidth: 120 },
    ];

    // 公共字段排序对应数据库表字段
    commonFieldSort = {
        outerOrderCode: 'C_OUT_ORDER_CODE',
        instNo: 'N_INST_NO',
        instructionNo: 'N_INST_NO',
        batchNo: 'N_BATCH_NO',
        fundCode: 'c_fund_code',
        fundName: 'c_fund_name',
        groupCode: "TO_NUMBER(REGEXP_REPLACE(C_FD_AC_CODE,'[^0-9]',''))",
        groupName: 'c_fd_ac_name',
        stockCode: 'c_stock_code',
        stockName: 'C_STOCK_NAME_ST',
        stockType: 'C_STOCK_TYPE',
        // stockTypeName: 'C_STOCK_TYPE_NAME',
        businessType: 'C_BUSINESS_TYPE',
        businessTypeName: 'C_BUSINESS_TYPE_NAME',
        orderDirection: 'C_ORIGINAL_DIRECTION',
        orderDirectionName: 'c_direction_name',
        investType: 'C_INVEST_TYPE',
        investTypeName: 'c_invest_type_name',
        orderPrice: 'N_INST_PRICE',
        orderBalance: 'N_INST_BALANCE',
        orderAmount: 'n_inst_amount',
        curCode: 'C_CUR_CODE',
        curName: 'C_CUR_NAME',
        marketCode: 'c_market_code',
        marketName: 'C_MARKET_NAME',
        directUserName: 'C_DIREACT_USER_NAME',
        directUser: 'C_DIREACT_USER',
        // directDate: 'D_DIRECT_DATE',
        directTime: 'D_DIRECT_TIME',
        instStatus: 'C_INST_STATUS',
        opponentCode: 'C_OPPONENT_CODE',
        opponentName: 'C_OPPONENT_NAME',
        orderPriceType: 'C_ORDER_PRICE_TYPE',
        assetCode: "TO_NUMBER(REGEXP_REPLACE(C_ASSET_CODE,'[^0-9]',''))",
        assetName: 'C_ASSET_NAME',
        fundAccountCode: "TO_NUMBER(REGEXP_REPLACE(C_FD_AC_CODE,'[^0-9]',''))",
        fundAccountName: 'c_fd_ac_name',
    };

    // 交易所指令额外字段
    exchangeFieldSort = {
        orderPriceType: 'C_ORDER_PRICE_TYPE',
    };

    // 银行间债券额外字段
    bankZQFieldSort = {
        netPrice: 'N_NET_PRICE',
        faceBalance: 'N_FACE_BALANCE',
        fullPrice: 'N_FULL_PRICE',
        netBalance: 'N_NET_BALANCE',
        totalInterest: 'totalInterest',
        settlementBalance: 'settlementBalance',
        orderPriceType: 'C_ORDER_PRICE_TYPE',
        clearSpeed: 'C_CLEAR_SPEED',
        firstSettleDate: 'D_FIRST_SETTLE_DATE',
    };

    // 银行间回购额外字段
    bankHGFieldSort = {
        orderRate: 'N_INST_PRICE',
        repoBalance: 'N_REPO_VALUE',
        repoDay: 'N_RE_RE_DAYS',
        shouldInterest: 'shouldInterest',
        expirePayBalance: 'expirePayBalance',
        opponentCode: 'C_OPPONENT_CODE',
        opponentName: 'C_OPPONENT_NAME',
        repoDate: 'D_REPO_DATE',
        repurDate: 'D_REPUR_DATE',
        orderPriceType: 'C_ORDER_PRICE_TYPE',
        clearSpeed: 'C_CLEAR_SPEED',
    };

    // 存款指令额外字段
    CKFieldSort = {
        depositType: 'C_DEPOSIT_TYPE',
        noticeDays: 'N_NOTIFY_DAYS',
        advanceLimitFlag: 'C_ADVANCE_TYPE',
        bankCode: 'C_BANK_CODE',
        bankName: 'c_bank_name',
        mutureDate: 'D_END_DATE',
        depositDeadline: 'N_PO_DAY_TERM',
        depositBalance: 'N_INST_BALANCE',
        depositRate: 'N_REATE',
        depositInterest: 'depositInterest',
        expireBalance: 'expireBalance',
    };

    // 交易所大宗额外字段
    BulkFieldSort = {
        stockType: 'C_STOCK_TYPE',
        opponentCode: 'C_OPPONENT_CODE',
        opponentName: 'C_OPPONENT_NAME',
        orderPriceType: 'C_ORDER_PRICE_TYPE',
        totalInterest: 'totalInterest',
    };

    // 上交所额外字段
    SHFixedFieldSort = {
        stockType: 'C_STOCK_TYPE',
        opponentCode: 'C_OPPONENT_CODE',
        opponentName: 'C_OPPONENT_NAME',
        orderPriceType: 'C_ORDER_PRICE_TYPE',
        fullPrice: 'N_FULL_PRICE',
        totalInterest: 'TOTAL_INTEREST',
        fullBalance: 'FULL_BALANCE',
        yield: 'N_YIELD',
    };

    // 指令结果表格列
    instResultColumn = [
        {
            name: '条目编号',
            val: 'entryCode',
            minWidth: 120,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '风险说明', val: 'entryName', width: 200, type: 'func', search: true, filters: [{ data: '' }], funcBody: value => value || '--' },
        {
            name: '触警类型',
            val: 'thresholdType',
            minWidth: 120,
            type: 'statusTag',
            sortable: true,
            selectSearch: true,
            filters: objToVxeFilterArr(this.Invest.ThresholdType),
        },
        {
            name: '条目触发值',
            val: 'thresholdValue',
            width: 150,
            type: 'func',
            funcBody: (value, record) => (value != undefined ? numberFormat(value, record.unit) + unitShow(record.unit) : '--'),
        },
        { name: '条目比较方向', val: 'compareType', width: 150, type: 'func', funcBody: value => DictionConstUtil.CompareDirection[value] },
        {
            name: '计算结果(单位)',
            val: 'calculateValue',
            width: 130,
            type: 'func',
            funcBody: (value, record) => (this.WEB_DOCKING === 'CIBFUND' && value != undefined ? numberFormatXDAY(value, record.unit) + unitShow(record.unit) : value != undefined ? numberFormat(value, record.unit) + unitShow(record.unit) : '--'),
        },
        {
            name: '产品代码',
            val: 'fundCode',
            minWidth: 120,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            // type: 'func',
            // funcBody: value => DictionConstUtil.FNFundShowCode(value),
        },
        {
            name: '证券代码',
            val: 'stockCode',
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            minWidth: 130,
            type: 'func',
            funcBody: value => value.trim() || '--',
        },
        { name: '计算逻辑', val: 'calLogicShow', width: 150, type: 'func', funcBody: value => value || '--' },
        { name: '是否报错', val: 'errorValid', width: 100, type: 'func', funcBody: value => (value === '0' ? '否' : '是') },
        { name: '报错信息', val: 'errorMessage', width: 120, type: 'func', funcBody: value => value || '--' },
        { name: '条目KEY', val: 'entryKey', width: 150, type: 'func', funcBody: value => value || '--' },
        { name: '流水号', val: 'resultId', width: 150, type: 'func', funcBody: value => value || '--' },
        {
            name: '计算日期',
            val: 'calculateDate',
            width: 150,
            type: 'func',
            funcBody: (value, record) =>
                moment(record.calculateDate + ' ' + PrefixInteger(record.calculateTime, 6), 'YYYYMMDD HHmmss').format('YYYY-MM-DD HH:mm:ss'),
        },
        {
            name: '操作',
            val: 'operate',
            width: 60,
            type: 'btn',
            btns: [
                {
                    title: '查看',
                    name: '查看',
                    type: 'primary',
                    icon: 'el-icon-view',
                },
            ],
        },
    ];

    get instResultColumns() {
        return this.handleColumns(this.instResultColumn, 'val', 'fundCode', [
            {
                name: '产品名称',
                val: 'fundNameSt',
                width: 140,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '资产单元编号',
                val: 'assetCode',
                width: 160,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '资产单元名称',
                val: 'assetName',
                width: 160,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '组合编码',
                val: 'fundAccountCode',
                width: 140,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '组合名称',
                val: 'fdAcName',
                width: 140,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
        ]);
    }

    // 指令证券表格列
    instStockColumn: any = [
        { name: '指令序号', val: 'instNo', minWidth: 100 },
        {
            name: '产品代码',
            val: 'fundCode',
            width: 100,
            type: 'func',
            funcBody: value => value || '--',
            // funcBody: (value) => DictionConstUtil.FNFundShowCode(value)
        },
        { name: '产品名称', val: 'fundNameSt', width: 100, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fdAcCode', width: 120, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fdAcName', width: 120, type: 'func', funcBody: value => value || '--' },
        { name: '证券代码', val: 'stockCode', width: 130, type: 'func', funcBody: value => (value && value.trim() ? value : '--') },
        { name: '证券名称', val: 'stockNameSt', width: 150, type: 'func', funcBody: value => value || '--' },
        { name: '委托方向', val: 'realDirection', width: 150, type: 'func', funcBody: value => value || '--' },
        {
            name: '交易市场',
            val: 'marketCode',
            width: 100,
            // type: 'func',
            // funcBody: value => this.nameType.marketCode[value],
        },
        { name: '投资类型', val: 'investType', width: 100, type: 'func', funcBody: value => (value ? this.Invest.investType[value] : '--') },
        {
            name: '指令数量',
            val: 'instAmount',
            width: 100,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        { name: '指令价格', val: 'instPrice', width: 100, type: 'func', funcBody: value => (value != undefined ? numberFormat(value, 2) : '--') },
        { name: '指令金额', val: 'instBalance', width: 100, type: 'func', funcBody: value => (value != undefined ? numberFormat(value, 2) : '--') },
        // { name: '交割日', val: 'deliveryDate', width: 100, type: 'func', funcBody: value => dateFormat(value) || '--' },
        { name: '交割日', val: 'firstSettleDate', width: 100, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { name: '回购日期', val: 'repoDate', width: 100, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { name: '回购天数', val: 'repoDay', width: 100, type: 'func', funcBody: value => value || '--' },
        { name: '回购到期日', val: 'repurDate', width: 100, type: 'func', funcBody: value => dateFormat(value) || '--', align: 'center' },
        { name: '存款类型', val: 'depositType', width: 100, type: 'func', funcBody: value => (value ? this.Invest.depositType[value] : '--') },
        { name: '存款利率', val: 'reate', width: 100, type: 'func', funcBody: value => (value != undefined ? numberFormat(value, 2) : '--') },
        { name: '存款期限(天)', val: 'poDayTerm', width: 100, type: 'func', funcBody: value => value || '--' },
        { name: '银行总行代码', val: 'bankCode', width: 100, type: 'func', funcBody: value => value || '--' },
        { name: '银行总行名称', val: 'bankNameSt', width: 150, type: 'func', funcBody: value => value || '--' },
        {
            name: '提前支取类型',
            val: 'advanceType',
            width: 130,
            type: 'func',
            funcBody: value => (value ? this.Invest.advanceLimitFlag[value] : '--'),
        },
    ];

    get instStockColumns() {
        return this.handleTableColumns(this.instStockColumn, 'val');
    }

    // 指令质押券表格列
    instPledgeColumn = [
        {
            name: '指令序号',
            val: 'instNo',
            minWidth: 100,
        },

        {
            name: '产品序号',
            val: 'fundCode',
            minWidth: 100,
            // funcBody: (value) => DictionConstUtil.FNFundShowCode(value)
        },
        {
            name: '产品名称',
            val: 'fundName',
            minWidth: 100,
        },
        {
            name: '组合编码',
            val: 'fdAcCode',
            width: 120,
        },
        {
            name: '组合名称',
            val: 'fdAcName',
            minWidth: 120,
        },
        {
            name: '证券代码',
            val: 'stockCode',
            width: 120,
        },
        {
            name: '证券名称',
            val: 'stockName',
            minWidth: 150,
        },

        {
            name: '交易市场',
            val: 'marketName',
            minWidth: 100,
            // type: 'func',
            // funcBody: value => this.nameType.marketCode[value],
        },
        {
            name: '券面总额(万元)',
            val: 'totalFacePrice',
            minWidth: 100,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 4) : '--'),
        },
        {
            name: '质押比率(%)',
            val: 'pledgeRate',
            minWidth: 100,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 3) : '--'),
        },
        {
            name: '当前面值(元)',
            val: 'facePrice',
            minWidth: 160,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },

        {
            name: '质押金额(万元)',
            val: 'balance',
            minWidth: 160,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 4) : '--'),
        },

        // {
        //     name: '质押数量',
        //     val: 'pledgeAmount',
        //     minWidth: 100,
        //     type: 'func',
        //     funcBody: value => (value != undefined ? numberFormat(value) : '0'),
        // },
        {
            name: '投资类型',
            val: 'investType',
            minWidth: 100,
            type: 'func',
            funcBody: value => this.Invest.investType[value],
        },

        {
            name: '债券到期日',
            val: 'endDate',
            minWidth: 100,
            type: 'func',
            funcBody: value => dateFormat(value) || '--',
            align: 'center',
        },
        {
            name: '托管机构',
            val: 'custodianName',
            minWidth: 100,
            type: 'func',
            funcBody: value => value || '--',
        },
    ];

    get instPledgeColumns() {
        return this.handleTableColumns(this.instPledgeColumn, 'val');
    }

    // 可质押债券列表
    pledgeColumn = [
        {
            name: '操作',
            val: 'operate',
            width: 60,
            type: 'btn',
            fixed: 'left',
            btns: [
                {
                    name: '选择',
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '证券代码', val: 'stockCode', minWidth: 120, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        {
            name: '证券名称',
            val: 'stockNameSt',
            minWidth: 120,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '证券类别', val: 'stockTypeName', minWidth: 120, type: 'func', funcBody: value => value || '--' },
        {
            name: '当前资金(万元)',
            val: 'totalPrice',
            minWidth: 130,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '当前面值(元)',
            val: 'facePrice',
            minWidth: 120,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
            align: 'right',
        },
        {
            name: '产品序号',
            val: 'fundCode',
            minWidth: 100,
            type: 'func',
            funcBody: value => value || '--',
            // funcBody: (value) => DictionConstUtil.FNFundShowCode(value)
        },
        { name: '产品名称', val: 'fundName', minWidth: 150, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '持仓标志', val: 'bullBearName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '投资类型', val: 'investTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人序号', val: 'issueCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人名称', val: 'issueName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        {
            name: '证券内评(恒生)',
            val: 'stockInnerGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '证券外评(恒生)',
            val: 'stockOuterGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人内评(恒生)',
            val: 'issueInnerGradeInfo',
            minWidth: 140,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人外评(恒生)',
            val: 'issueOuterGradeInfo',
            minWidth: 140,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '债券到期日',
            val: 'endDate',
            width: 100,
            type: 'func',
            funcBody: value => dateFormat(value) || '--',
            align: 'center',
        },
        {
            name: '托管机构',
            val: 'custodianName',
            width: 100,
            type: 'func',
            funcBody: value => value || '--',
        },
    ];

    get pledgeColumns() {
        return this.handleTableColumns(this.pledgeColumn, 'val');
    }

    // 已选质押券表格部分列
    selectedPledgeColumn = [
        {
            name: '操作',
            val: 'operate',
            minWidth: 60,
            type: 'btn',
            btns: [
                {
                    title: '选择',
                    name: '选择',
                    type: 'primary',
                    icon: 'el-icon-close',
                },
            ],
            fixed: 'left',
        },
        {
            name: '券面总额(万元)',
            val: 'totalFacePrice',
            minWidth: 160,
            funcBody: value => (value != undefined ? numberFormat(value, 4) : '--'),
            align: 'right',
        },
        {
            name: '质押比率(%)',
            val: 'pledgeRatio',
            minWidth: 160,
            align: 'right',
        },

        {
            name: '质押金额(万元)',
            val: 'balance',
            minWidth: 160,
            funcBody: value => (value != undefined ? numberFormat(value, 4) : '--'),
            align: 'right',
        },
        {
            name: '当前资金(万元)',
            val: 'totalPrice',
            minWidth: 150,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },
        {
            name: '当前面值(元)',
            val: 'facePrice',
            minWidth: 110,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
            align: 'right',
        },

        { name: '证券代码', val: 'stockCode', width: 120, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        { name: '证券名称', val: 'stockNameSt', width: 120, search: true, filters: [{ data: '' }], type: 'func', funcBody: value => value || '--' },
        { name: '证券类别', val: 'stockTypeName', width: 120, type: 'func', funcBody: value => value || '--' },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 110,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value) : '--'),
        },
        {
            name: '产品序号',
            val: 'fundCode',
            width: 100,
            type: 'func',
            funcBody: value => value || '--',
            // funcBody: (value) => DictionConstUtil.FNFundShowCode(value)
        },
        { name: '产品名称', val: 'fundName', width: 100, type: 'func', funcBody: value => value || '--' },
        { name: '组合编码', val: 'fundAcCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '组合名称', val: 'fundAcName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '交易市场', val: 'marketName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '持仓标志', val: 'bullBearName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '投资类型', val: 'investTypeName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人序号', val: 'issueCode', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        { name: '发行人名称', val: 'issueName', minWidth: 110, type: 'func', funcBody: value => value || '--' },
        {
            name: '证券内评(恒生)',
            val: 'stockInnerGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '证券外评(恒生)',
            val: 'stockOuterGradeInfo',
            minWidth: 130,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人内评(恒生)',
            val: 'issueInnerGradeInfo',
            minWidth: 180,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '发行人外评(恒生)',
            val: 'issueOuterGradeInfo',
            minWidth: 150,
            type: 'func',
            funcBody: value => (value == '空' ? '--' : value) || '--',
        },
        {
            name: '债券到期日',
            val: 'endDate',
            width: 100,
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '托管机构',
            val: 'custodianName',
            width: 100,
            type: 'func',
            funcBody: value => value || '--',
        },
    ];

    get selectedPledgeColumns() {
        return this.handleTableColumns(this.selectedPledgeColumn, 'val');
    }
    /* ********************** 基金转换指令start *********************** */

    // 可转出证券
    outStockColumn = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '证券类别',
            val: 'stockType',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '开放式基金', value: 'F' },
                { label: '理财产品', value: 'U' },
                { label: 'REITS基金', value: '49' },
            ],
            type: 'func',
            funcBody: (value, row) => row.stockTypeName || '--',
        },
        { name: '交易市场', val: 'marketName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '持仓数量',
            val: 'currentAmount',
            minWidth: 150,
            sortable: true,

            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '状态',
            val: 'status',
            minWidth: 110,
            sortable: true,
            filters: [
                { label: '正常', value: '1' },
                { label: '停牌', value: '2' },
            ],
            type: 'func',
            funcBody: value => (value ? DictionConstUtil.stockStatus[value] : '--'),
        },
        { name: '单位净值', val: 'lastPrice', minWidth: 130, sortable: true, type: 'funcNumber', funcBody: value => value || '--' },
        {
            name: '持仓市值',
            val: 'marketValue',
            minWidth: 130,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        { name: '产品序号', val: 'fundCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '产品名称', val: 'fundName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合编码', val: 'fundAcCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合名称', val: 'fundAcName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '投资类型', val: 'investTypeName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '分红方式',
            val: 'bonusType',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '现金分红', value: '1' },
                { label: '分红再投资', value: '2' },
            ],
            type: 'func',
            funcBody: (value, row) => row.bonusTypeName || '--',
        },
        {
            name: '收费方式',
            val: 'feeType',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '前收费', value: '1' },
                { label: '后收费', value: '2' },
            ],
            type: 'func',
            funcBody: value => (value ? DictionConstUtil.feeType[value] : '--'),
        },
        { name: '基金备注', val: 'memo', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
    ];

    get outStockColumns() {
        return this.handleTableColumns(this.outStockColumn, 'val', [
            // todo 过滤和搜索
            {
                name: '资产单元编号',
                val: 'assetCode',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '资产单元名称',
                val: 'assetName',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
        ]);
    }

    // 可转入证券
    intoStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },

        {
            name: '证券代码',
            val: 'stockCode',
            width: 130,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '证券类别',
            val: 'stockType',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '开放式基金', value: 'F' },
                { label: '理财产品', value: 'U' },
                { label: 'REITS基金', value: '49' },
            ],
            type: 'func',
            funcBody: (value, row) => row.stockTypeName || '--',
        },
        { name: '交易市场', val: 'marketName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
    ];

    // 可转入、可转出证券排序字段
    stockFieldSort = {
        bonusType: 'C_BONUS_TYPE',
        bonusTypeName: 'C_BONUS_TYPE_NAME',
        currentAmount: 'L_CURRENT_AMOUNT',
        feeType: 'C_FEE_TYPE',
        fundAcCode: 'C_FUND_AC_CODE',
        fundAcName: 'C_FUND_AC_NAME',
        fundCode: 'C_FUND_CODE',
        fundName: 'C_FUND_NAME',
        investType: 'C_INVEST_TYPE',
        investTypeName: 'C_INVEST_TYPE_NAME',
        lastPrice: 'EN_LAST_PRICE',
        marketCode: 'C_MARKET_NO',
        marketName: 'C_MARKET_NAME',
        marketValue: 'N_MARKET_VALUE',
        memo: 'VC_MEMO',
        status: 'C_STATUS',
        stockCode: 'C_STOCK_CODE',
        stockName: 'C_STOCK_NAME',
        stockNameSt: 'C_STOCK_NAME_ST',
        stockType: 'C_STOCK_TYPE',
        stockTypeName: 'C_STOCK_TYPE_NAME',
    };

    // 基金转换指令额外字段
    fundTransferFieldSort = {
        bulkType: 'BULK_TYPE',
        destSecurityCode: 'DEST_SECURITY_CODE',
        destSecurityName: 'DEST_SECURITY_NAME',
        destCombiName: 'DEST_COMBI_NAME',
        destCombiId: 'DEST_COMBI_ID',
    };

    // 转融通
    refinancingFieldSort = {
        rate: 'N_PRICE',
        deadline: 'N_REDEEM_DAY',
        stockType: 'C_ST_TYPE_NAME', // 证券类别
    };
    /* ********************** 基金转换指令end *********************** */

    /* ********************** 融资融券指令start *********************** */
    // 融资标的券
    financingStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '交易市场',
            val: 'marketName',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '上交所A', value: '1' },
                { label: '深交所A', value: '2' },
            ],
        },
        {
            name: '融资保证金比例(%)',
            val: 'enValue',
            minWidth: 180,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
        },
    ];

    // 融券标的券
    marginStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '交易市场',
            val: 'marketName',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '上交所A', value: '1' },
                { label: '深交所A', value: '2' },
            ],
        },
        {
            name: '融券保证金比例(%)',
            val: 'enValue',
            minWidth: 180,
            sortable: true,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
        },
        {
            name: '可融券数量',
            val: 'enEnableAmount',
            minWidth: 150,
            sortable: true,
            type: 'func',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
    ];

    // 融资标的券持仓、融券标的券持仓
    underlyingPositionColumn = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '产品代码', val: 'fundCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '产品名称', val: 'fundName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合编码', val: 'fundAcCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合名称', val: 'fundAcName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 150,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
    ];

    get underlyingPositionColumns() {
        return this.handleTableColumns(this.underlyingPositionColumn, 'val', [
            // todo 过滤和搜索
            {
                name: '资产单元编号',
                val: 'assetCode',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
            {
                name: '资产单元名称',
                val: 'assetName',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
            },
        ]);
    }

    // 担保券持仓
    GuaranteePositionColumn = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '产品代码', val: 'fundCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '产品名称', val: 'fundName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合编码', val: 'fundAcCode', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '组合名称', val: 'fundAcName', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '实时持仓数量',
            val: 'currentAmount',
            minWidth: 150,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value == '0' ? '0.00' : numberFormat(value) || '--'),
        },
        {
            name: '折算率(%)',
            val: 'enValue',
            minWidth: 120,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
        },
    ];

    get GuaranteePositionColumns() {
        return this.handleTableColumns(this.GuaranteePositionColumn, 'val', [
            // todo 过滤和搜索
            {
                name: '资产单元编号',
                val: 'assetCode',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
                align: 'right',
            },
            {
                name: '资产单元名称',
                val: 'assetName',
                minWidth: 150,
                sortable: true,
                search: true,
                filters: [{ data: '' }],
                type: 'func',
                funcBody: value => value || '--',
                align: 'right',
            },
        ]);
    }

    // 担保券
    GuaranteeStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },
        { name: '证券代码', val: 'stockCode', width: 130, sortable: true, search: true, filters: [{ data: '' }] },
        { name: '证券名称', val: 'stockNameSt', minWidth: 130, sortable: true, search: true, filters: [{ data: '' }] },
        {
            name: '交易市场',
            val: 'marketName',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '上交所A', value: '1' },
                { label: '深交所A', value: '2' },
            ],
        },
        {
            name: '折算率(%)',
            val: 'enValue',
            minWidth: 120,
            sortable: true,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
        },
    ];

    // 可申购证券
    PurchaseStockColumns = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['disabled'],
                },
            ],
        },

        {
            name: '证券代码',
            val: 'stockCode',
            width: 130,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '证券名称',
            val: 'stockName',
            minWidth: 130,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
        },
        {
            name: '证券类别',
            val: 'stockTypeName',
            minWidth: 130,
            sortable: true,
            filters: [
                { label: '股票申购', value: 'a' },
                { label: '存托凭证申购', value: '23' },
                { label: '存托凭证增发', value: '27' },
                { label: '债券申购', value: 'k' },
                { label: '增发', value: 'd' },
                { label: 'REITS基金认购', value: '50' },
            ],
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '交易市场',
            val: 'marketName',
            minWidth: 130,
            sortable: true,

            filters: [
                { label: '上交所A', value: '1' },
                { label: '深交所A', value: '2' },
            ],
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '发行人编码',
            val: 'issuerCode',
            minWidth: 140,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '发行人名称',
            val: 'issuerName',
            minWidth: 140,
            sortable: true,
            search: true,
            filters: [{ data: '' }],
            type: 'func',
            funcBody: value => value || '--',
        },
        {
            name: '价格下限(元)',
            val: 'lowerPrice',
            minWidth: 140,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '价格上限(元)',
            val: 'upperPrice',
            minWidth: 140,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        { name: '缴款截止日期', val: 'payLimitDate', minWidth: 150, sortable: true, type: 'funcTime', funcBody: value => dateFormat(value) || '--' },
        {
            name: '网下申购数量下限',
            val: 'lowerApplyAmount',
            minWidth: 180,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '网下申购数量上限',
            val: 'upperApplyAmount',
            minWidth: 180,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '定金比例(%)',
            val: 'earnestRatio',
            minWidth: 130,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, '%') : '--'),
        },
        {
            name: '定金金额',
            val: 'earnestBalance',
            minWidth: 130,
            sortable: true,
            type: 'funcNumber',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        { name: '中签日期', val: 'lotDate', minWidth: 130, sortable: true, type: 'funcTime', funcBody: value => dateFormat(value) || '--' },
        {
            name: '发行总量',
            val: 'issueAmount',
            minWidth: 130,
            sortable: true,
            type: 'func',
            funcBody: value => (value != undefined ? numberFormat(value, 2) : '--'),
        },
        {
            name: '申购类型',
            val: 'applyTypeName',
            filters: [{ label: '申购', value: '1' }],
            minWidth: 130,
            sortable: true,
            type: 'func',
            funcBody: value => value || '--',
        },
        { name: '利率类型', val: 'basicInterestTypeName', minWidth: 130, sortable: true, type: 'func', funcBody: value => value || '--' },
        {
            name: '是否有担保',
            val: 'assureType',
            filters: [
                { label: '无担保', value: '0' },
                { label: '有担保', value: '1' },
            ],
            minWidth: 150,
            sortable: true,
            type: 'func',
            funcBody: value => (value ? (value === '0' ? '无担保' : '有担保') : '--'),
        },
        {
            name: '是否附送权证',
            val: 'attachWarrant',
            filters: [
                { label: '否', value: '0' },
                { label: '是', value: '1' },
            ],
            minWidth: 150,
            sortable: true,
            type: 'func',
            funcBody: value => (value ? (value === '0' ? '否' : '是') : '--'),
        },
    ];

    // 融资融券相关排序字段
    MarginTradingSortField = {
        fundCode: 'VC_FUND_CODE',
        fundName: 'VC_FUND_NAME',
        fundAcCode: 'C_FUND_AC_CODE',
        fundAcName: 'C_FUND_AC_NAME',
        stockCode: 'C_STOCK_CODE',
        stockName: 'VC_STOCK_FULLNAME',
        stockNameSt: 'VC_STOCK_NAME',
        marketNo: 'C_MARKET_NO',
        marketName: 'VC_MARKET_NAME',
        currentAmount: 'L_CURRENT_AMOUNT',
        enValue: 'EN_VALUE',
        enEnableAmount: 'EN_ENABLE_AMOUNT',
        assetCode: "TO_NUMBER(REGEXP_REPLACE(C_ASSET_CODE,'[^0-9]',''))",
        assetName: 'C_ASSET_NAME',
    };

    // 可申购证券排序字段
    purchaseSortFields = {
        applyType: 'C_APPLY_TYPE',
        applyTypeName: 'C_APPLY_TYPE_NAME',
        assureType: 'C_ASSURE_TYPE',
        attachWarrant: 'C_ATTACH_WARRANT',
        basicInterestType: 'C_BASIC_INTEREST_TYPE',
        basicInterestTypeName: 'C_BASIC_INTEREST_TYPE_NAME',
        earnestBalance: 'EN_EARNEST_BALANCE',
        earnestRatio: 'EN_EARNEST_RATIO',
        issueAmount: 'L_ISSUE_AMOUNT',
        issuerCode: 'L_COMPANY_ID',
        issuerName: 'VC_ISSUER_NAME',
        lotDate: 'L_LOT_DATE',
        lowerApplyAmount: 'EN_LOWER_APPLYAMOUNT',
        lowerPrice: 'EN_LOWER_PRICE',
        marketName: 'VC_MARKET_NAME',
        marketNo: 'C_MARKET_NO',
        payLimitDate: 'L_PAY_LIMIT_DATE',
        purchasingType: 'C_PURCHASING_TYPE',
        purchasingTypeName: 'C_PURCHASING_TYPE_NAME',
        stockCode: 'C_STOCK_CODE',
        stockName: 'VC_STOCK_NAME',
        stockType: 'C_STOCK_TYPE',
        stockTypeName: 'VC_STOCKTYPE_NAME',
        upperApplyAmount: 'EN_UPPER_APPLYAMOUNT',
        upperPrice: 'EN_UPPER_PRICE',
    };

    /* *********************** 融资融券指令end ************************ */

    // 可投标债券表格
    bidStockColumns: any[] = [
        {
            name: '操作',
            type: 'btn',
            width: 60,
            fixed: 'left',
            btns: [
                {
                    type: 'primary',
                    icon: 'el-icon-check',
                    isDisabled: value => value['isBid'] != '1' || value['disabled'],
                },
            ],
        },
        { name: '债券代码', val: 'bondCode', minWidth: '110px', fixed: 'left' },
        { name: '债券简称', val: 'bondNameSt', minWidth: '140px', fixed: 'left' },
        { name: '债券类别', val: 'bondType', minWidth: '110px' },
        { name: '投标开始日期', val: 'bidStartDate', minWidth: '120px', type: 'func', funcBody: value => dateFormat(value) || '--' },
        { name: '投标截止日期', val: 'bidEndDate', minWidth: '120px', type: 'func', funcBody: value => dateFormat(value) || '--' },
        {
            name: '投标剩余时间',
            val: 'bidRemainTime',
            minWidth: '130px',
            type: 'func',
            funcBody: (value, row) =>
                row.isBid == '1' ? row.bidRemainTime : row.isBid == '2' ? '投标未开始' : row.isBid == '3' ? '投标已截止' : '--',
        },
        { name: '投标区间', val: 'bidSection', minWidth: '110px' },
        {
            name: '信用评级(主体/债券)',
            val: 'compGrade',
            minWidth: '180px',
            type: 'func',
            funcBody: (value, row) => (row.compGrade || '空') + '/' + (row.debtRating || '空'),
        },
        { name: '交易市场', val: 'marketName', minWidth: '110px' },
        {
            name: '招标标的',
            val: 'bidSubject',
            minWidth: '110px',
            type: 'func',
            funcBody: (value, row) => (row.bidSubject === '1' ? '利率' : row.bidSubject === '3' ? '价格' : '--'),
        },
        { name: '缴款日期', val: 'payDate', minWidth: '110px', type: 'func', funcBody: value => dateFormat(value) || '--' },
        { name: '上市日期', val: 'listDate', minWidth: '110px', type: 'func', funcBody: value => dateFormat(value) || '--' },
        { name: '发行规模(亿)', val: 'totalBalance', minWidth: '130px' },
        { name: '发行人编码', val: 'issueCode', minWidth: '110px' },
        { name: '发行人名称', val: 'issueName', minWidth: '110px' },
        {
            name: '发行人性质',
            val: 'issueNature',
            minWidth: '130px',
            type: 'func',
            funcBody: (value, row) => {
                switch (value) {
                    case '001001':
                        return '国有企业';
                    case '001002':
                        return '民营企业';
                    case '001006':
                        return '中资企业';
                    case '002001':
                        return '外资企业';
                    case '003001':
                        return '中外合资企业';
                    case ' ':
                        return '--';
                    default:
                        return '其他';
                }
            },
        },
    ];

    // 资产单元+资产名称(表格)
    handleTableColumns(columns: any, param: string, data1?: any) {
        let data = [];
        if (data1) {
            data = data1;
        } else {
            if (param == 'id') {
                data = [
                    { content: '资产单元编号', id: 'assetCode', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                    { content: '资产单元名称', id: 'assetName', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                ];
            } else if (param == 'val') {
                data = [
                    { name: '资产单元编号', val: 'assetCode', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                    { name: '资产单元名称', val: 'assetName', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                ];
            }
        }

        if (this.SHOW_SECURITY) {
            const index = columns.findIndex(
                item => item[param] == 'groupCode' || item[param] == 'fundAccountCode' || item[param] == 'fdAcCode' || item[param] == 'fundAcCode'
            );
            return columns
                .slice(0, index)
                .concat(data)
                .concat(columns.slice(index));
        } else {
            return columns;
        }
    }

    // 试算持仓(表格)
    handleTrailPositionColumns(columns: any, param: string): any {
        let data1 = [];
        let data2 = [];
        if (param == 'id') {
            data1 = [{ content: '组合名称', id: 'fdAcName', width: 110, type: 'func', funcBody: value => value || '--' }];
            data2 = [
                { content: '资产单元编号', id: 'assetCode', width: 110, type: 'func', funcBody: value => value || '--' },
                { content: '资产单元名称', id: 'assetName', width: 110, type: 'func', funcBody: value => value || '--' },
            ];
        } else if (param == 'val') {
            data1 = [{ name: '组合名称', val: 'fdAcName', width: 110, type: 'func', funcBody: value => value || '--' }];
            data2 = [
                { name: '资产单元编号', val: 'assetCode', width: 110, type: 'func', funcBody: value => value || '--' },
                { name: '资产单元名称', val: 'assetName', width: 110, type: 'func', funcBody: value => value || '--' },
            ];
        }
        if (this.SHOW_SECURITY) {
            const index = columns.findIndex(item => item[param] == 'groupCode' || item[param] == 'fundAccountCode' || item[param] == 'fdAcCode');
            const retValue = columns
                .slice(0, index + 1)
                .concat(data1)
                .concat(columns.slice(index + 1));
            return retValue
                .slice(0, index)
                .concat(data2)
                .concat(retValue.slice(index));
        } else {
            return columns;
        }
    }

    // 处理明细字段(券商模式)
    handleFields(columnArr, param: string, beforeParam: string): any {
        let data = [];
        if (param == 'id') {
            data = data = [
                { content: '资产单元编号', id: 'assetCode', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                { content: '资产单元名称', id: 'assetName', minWidth: 140, type: 'func', funcBody: value => value || '--' },
            ];
        } else if (param == 'val') {
            data = [
                { name: '资产单元编号', val: 'assetCode', minWidth: 140, type: 'func', funcBody: value => value || '--' },
                { name: '资产单元名称', val: 'assetName', minWidth: 140, type: 'func', funcBody: value => value || '--' },
            ];
        }
        if (this.SHOW_SECURITY) {
            let index = -1;
            const arrIndex = columnArr.findIndex(item => {
                index = item.findIndex(ele => ele[param] == beforeParam);
                console.log(index, 'index');
                return index > -1;
            });
            if (arrIndex > -1) {
                const data = columnArr[arrIndex];
                columnArr[arrIndex] = data
                    .slice(0, index + 1)
                    .concat(data)
                    .concat(data.slice(index + 1));
            }
        }
        return columnArr;
    }

    // 试算结果
    handleResultColumns(columns, param: string, data1?: any): any {
        let data = [];
        if (data1) {
            data = data1;
        } else if (param == 'id') {
            data = [
                { content: '资产单元编号', id: 'assetCode', sortable: true, minWidth: 160, filterType: 'search', filters: [{ data: '' }] },
                { content: '资产单元名称', id: 'assetName', sortable: false, minWidth: 160, filterType: 'search', filters: [{ data: '' }] },
                { content: '组合编码', id: 'fundAccountCode', sortable: true, minWidth: 120, filterType: 'search', filters: [{ data: '' }] },
                { content: '组合名称', id: 'fundAccountName', sortable: false, minWidth: 120, filterType: 'search', filters: [{ data: '' }] },
            ];
        } else if (param == 'val') {
            data = [
                { name: '资产单元编号', val: 'assetCode', sortable: true, minWidth: 160, filterType: 'search', filters: [{ data: '' }] },
                { name: '资产单元名称', val: 'assetName', sortable: false, minWidth: 160, filterType: 'search', filters: [{ data: '' }] },
                { name: '组合编码', val: 'fundAccountCode', sortable: true, minWidth: 120, filterType: 'search', filters: [{ data: '' }] },
                { name: '组合名称', val: 'fundAccountName', sortable: false, minWidth: 120, filterType: 'search', filters: [{ data: '' }] },
            ];
        }
        if (this.SHOW_SECURITY) {
            const index = columns.findIndex(item => item[param] == 'fundNameSt') + 1;
            return columns
                .slice(0, index)
                .concat(data)
                .concat(columns.slice(index));
        } else {
            return columns;
        }
    }

    // 字段不定式处理
    handleColumns(columns: any, param: string, paramName: string, data: any, immediate?: boolean) {
        if (this.SHOW_SECURITY || immediate) {
            const index = columns.findIndex(item => item[param] == paramName) + 1;
            const retDatas = columns
                .slice(0, index)
                .concat(data)
                .concat(columns.slice(index));
            return retDatas;
        } else {
            return columns;
        }
    }

    /**
     * 券商模式指令明细添加字段
     * param:data:处理数据   find:是否查询指定数据  pendingData:待加入数据
     */
    handleDetailFieldsOnSecurity(data: any, find: boolean, pendingData: any, keyName?: string, targetKey?: string) {
        if (!this.SHOW_SECURITY) {
            return data;
        }
        let retData = [];
        let isContinue = true;
        data.forEach((arr1, index) => {
            if (!isContinue) {
                return;
            }
            if (find) {
                // 指定需查找位置
                let key = arr1.findIndex(item => item[keyName] == 'fundNameSt');
                targetKey = 'fundNameSt';
                if (key == -1) {
                    key = arr1.findIndex(item => item[keyName] == 'fundName');
                    targetKey = 'fundName';
                }
                if (key > -1) {
                    // 能找到
                    arr1 = this.handleColumns(arr1, keyName, targetKey, pendingData);
                    isContinue = false;
                } else {
                    // 不能找到
                    retData.push(arr1);
                    return;
                }
            } else {
                isContinue = false;
                if (pendingData.length == 1) {
                    arr1.unshift(pendingData);
                } else {
                    arr1 = pendingData.concat(arr1);
                }
            }

            if (arr1.length <= 7) {
                retData.push(arr1);
                // 可直接结束
                return;
            } else if (arr1.length > 7) {
                // 多余数据
                const otherData = arr1.slice(7);
                arr1 = arr1.slice(0, 7);
                retData.push(arr1);
                const needData = this.handleDetailFieldsOnSecurity(data.slice(index + 1), false, otherData);
                retData = retData.concat(needData);
            }
        });
        console.log(retData, 'retData');
        if (!data.length && pendingData.length) {
            return [pendingData];
        }
        return retData;
    }
}
